import java.util.Scanner;
import java.util.Stack;

/**
 * @author ShenTuZhiGang
 * @version 1.0.0
 * @email 1600337300@qq.com
 * @date 2021-09-26 20:38
 */
public class ExamTencent2021092603 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        Calculate cal = new Calculate();
        System.out.println(cal.calculate(s));
    }
}


class Calculate {
    /**
     * 运算符优先级表
     * 0 ： 栈顶运算符弹出
     * 1 ： 当前运算符入栈
     * -1 ： 操作数和运算符弹出进行运算后入栈
     */
    public static final int[][] TABLE = {
            /*        #  +  *  @      当前运算符  */
            /* # */    {0, 1, 1, 1},
            /* + */    {-1, -1, 1, 1},
            /* * */    {-1, -1, -1, 1},
            /* @ */    {-1, -1, -1, -1},
            /*  栈顶运算符  */
    };
    /**
     * 数字栈
     */
    public static final Stack<Long> DIGITALSTACK = new Stack<>();
    /**
     * 运算符栈
     */
    public static final Stack<Character> SYMBLESTACK = new Stack<>();

    public long calculate(String str) {
        str += '#';
        SYMBLESTACK.push('#');
        int length = str.length();
        // 判断是否为连续数字 （上一个是否为数字）
        boolean flag = false;
        for (int i = 0; i < length; i++) {
            char c = str.charAt(i);
            // 当前字符为数字
            if (Character.isDigit(c)) {
                // 上一字符为数字
                if (flag) {
                    long t = DIGITALSTACK.pop();
                    t = t * 10 + c - '0';
                    DIGITALSTACK.push(t);
                } else {
                    DIGITALSTACK.push((long) (c - '0'));
                    flag = true;
                }
            } else { // 当前字符为符号
                char pre = SYMBLESTACK.peek();
                switch (TABLE[changeDig(pre)][changeDig(c)]) {
                    case 0:
                        SYMBLESTACK.pop();
                        break;
                    case 1:
                        SYMBLESTACK.push(c);
                        break;
                    case -1:
                        i--; // 退一位
                        long num = yunSuan(DIGITALSTACK.pop(), DIGITALSTACK.pop(), SYMBLESTACK.pop());
                        DIGITALSTACK.push(num);
                        break;
                    default:
                        break;
                }
                flag = false;
            }
        }

        return DIGITALSTACK.pop();
    }

    /**
     * 将字符转换为二维表的下标
     */
    private int changeDig(char c) {
        int dig = 0;
        switch (c) {
            case '#':
                dig = 0;
                break;
            case '+':
                dig = 1;
                break;
            case 'x':
                dig = 2;
                break;
            case '@':
                dig = 3;
                break;
            default:
                break;
        }
        return dig;
    }

    /**
     * 运算
     * 注意出入栈顺序
     */
    private long yunSuan(long numOne, long numTwo, char c) {
        long result = 0;
        switch (c) {
            case '+':
                result = numTwo + numOne;
                break;
            case 'x':
                result = numTwo * numOne;
                break;
            case '@':
                result = numTwo | (numTwo + numOne);
                break;
        }
        return result;
    }

}

